<html>
<head><meta charset="utf-8"><title>cargo doc opens in the wrong browser · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/cargo.20doc.20opens.20in.20the.20wrong.20browser.html">cargo doc opens in the wrong browser</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207924028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/cargo%20doc%20opens%20in%20the%20wrong%20browser/near/207924028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/cargo.20doc.20opens.20in.20the.20wrong.20browser.html#207924028">(Aug 25 2020 at 04:32)</a>:</h4>
<p>When I tried using <code>cargo doc --open</code> for the first time on this device, it opened up in <code>dillo</code>. I couldn't figure out how to change the default browser or whatever to make it open it in <code>chromium</code>, so I just <em>uninstalled</em> <code>dillo</code>. Easy victory, right? No, now <code>cargo doc --open</code> opens the file in <code>geany</code> instead.</p>
<p>So, how does <code>cargo doc</code> decide what browser to open the page in?</p>
<p>OS: Raspberry Pi OS 64-bit. It's like a modified Debian kinda.</p>



<a name="207925452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/cargo%20doc%20opens%20in%20the%20wrong%20browser/near/207925452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/cargo.20doc.20opens.20in.20the.20wrong.20browser.html#207925452">(Aug 25 2020 at 05:08)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> <code>cargo doc --open</code> uses the <code>opener</code> crate, which on Linux uses <a href="https://github.com/Seeker14491/opener/blob/master/opener/src/xdg-open">a copy of <code>xdg-open</code></a>.</p>



<a name="207925458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/cargo%20doc%20opens%20in%20the%20wrong%20browser/near/207925458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/cargo.20doc.20opens.20in.20the.20wrong.20browser.html#207925458">(Aug 25 2020 at 05:08)</a>:</h4>
<p><code>xdg-open</code> tries to open your default browser; how it detects that depends on your environment.</p>



<a name="207925468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/cargo%20doc%20opens%20in%20the%20wrong%20browser/near/207925468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/cargo.20doc.20opens.20in.20the.20wrong.20browser.html#207925468">(Aug 25 2020 at 05:08)</a>:</h4>
<p>Setting your default browser in your desktop environment is typically the easiest solution.</p>



<a name="207925564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/cargo%20doc%20opens%20in%20the%20wrong%20browser/near/207925564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/cargo.20doc.20opens.20in.20the.20wrong.20browser.html#207925564">(Aug 25 2020 at 05:11)</a>:</h4>
<p>If you don't have a default set (or don't have a desktop environment), it'll look for an application that says it can handle an HTML file.</p>



<a name="207925621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/cargo%20doc%20opens%20in%20the%20wrong%20browser/near/207925621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/cargo.20doc.20opens.20in.20the.20wrong.20browser.html#207925621">(Aug 25 2020 at 05:12)</a>:</h4>
<p>If you want to override all of that and you don't have a convenient way to set your desktop environment's default browser, just set the <code>BROWSER</code> environment variable (e.g. <code>BROWSER=firefox</code> or <code>BROWSER=chromium</code>).</p>



<a name="207926475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/cargo%20doc%20opens%20in%20the%20wrong%20browser/near/207926475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/cargo.20doc.20opens.20in.20the.20wrong.20browser.html#207926475">(Aug 25 2020 at 05:37)</a>:</h4>
<p>so i fiddled with xdg a bit and couldn't get it to use chromium, but chromium itself has a button in the settings so that the browser can make itself the default browser, and whatever that button does it worked and the docs open in chromium now.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>